package state.person.events;

import messages.ByteList;
import messages.CString;
import state.group.events.EventType;

public class GoingInEvent extends BasePersonEvent {
    
    private byte elevatorId;
    
    public GoingInEvent(byte[] data, int startIndex)
    {
        super(data, startIndex);
        this.elevatorId = data[2 + personId.getLength()];
    }
    
    public GoingInEvent(CString personId, byte elevatorId)
    {
        super(personId);
        this.elevatorId = elevatorId;
    }
    
    public byte getElevatorId()
    {
        return elevatorId;
    }
    
    public void appendToByteList(ByteList list)
    {
        super.appendToByteList(list);
        list.addByte(elevatorId);
    }
    
    @Override
    public int getEventByteLength()
    {
        return 2 + personId.getLength();
    }

    @Override
    public EventType getEventType()
    {
        return EventType.GoingInEvent;
    }

}
